package com.chenju.javastatic.repository;

import com.chenju.javastatic.domain.node.AnnotationNode;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;

public interface AnnotationRepository extends Neo4jRepository<AnnotationNode, Long> {
    @Query("MATCH (n:MethodNode), (n:AnnotationNode) WHERE n.id=n.foreignId AND n.type='METHOD' MERGE (a)-[r:ANN]->(n)")
    void createReleationShipToMethod();

    @Query("MATCH (m:ClassNode), (a:AnnotationNode) WHERE a.foreignId = m.id AND a.type='CLASS' MERGE (a)-[r:ANN]->(m)")
    void createReleationShipToClass();
}
